package LFhalf {
	import flash.events.Event;
	import flash.utils.ByteArray;
	import tea.game.dataContainer;
	public class DataProcesser{
		static private var share:DataProcesser;
		static public function get instance():DataProcesser {
			if (share == null) {
				share = new DataProcesser();
			}
			return share;
		}
		public function DataProcesser():void {
			
		}
		//=========================
		public var dataList:XML;
		public var bmpList:XML;
		public function init(maindata:ByteArray):void {
			dataList = new XML(maindata);
			for (var i:String in dataList.record) {
				if (String(dataList.record[i].path) != "") {
					dataContainer.getInstance().load(dataList.record[i].path);
				}
			}
			dataContainer.getInstance().addEventListener("allDone", dataInitFinish);
		}
		
		private function dataInitFinish(e:Event):void 
		{
			trace('dataInitFinish')
			Game.instance.init();
			Game.instance.tempStart();
		}
		public function getType(tag:String):String {
			for (var type:String in dataList) {
				return dataList.record.(@tag==tag).@type;
			}
			return 'fail'
		}
		public function getStage(tag:String):XMLList {
			return dataList.record.(@tag == tag && @type == "stage");
		}
		public function getObj(tag:String):XMLList {
			return dataList.record.(@tag == tag);
		}
		public function getData(tag:String):XML {
			var _data = dataContainer.getInstance().getData(dataList.record.(@tag == tag).path);
			
			return new XML(_data);
		}
	}
}